package main

import (
	"fmt"
)

func main() {
	fmt.Println("Testing pixel value extraction approach")
	
	// In our actual implementation, we'll check for different image types:
	// 1. *image.Gray16 - for 16-bit grayscale images
	// 2. *image.Gray - for 8-bit grayscale images
	// 3. Other types - fallback to RGBA conversion
	
	// For 16-bit signed integer data like our DEM:
	// If we have a *image.Gray16, we can extract the Y value directly
	// The Y value is a uint16, but our DEM data is signed 16-bit integers
	// So we need to convert it appropriately
	
	// Example: if we read a value of 30000 from uint16,
	// and we know it represents a signed 16-bit integer,
	// we need to interpret it correctly
	
	// For signed 16-bit integers:
	// Range is -32,768 to 32,767
	// If value > 32,767, it should be interpreted as negative
	
	// Test the conversion approach:
	testValue := uint16(1500) // This would come from Gray16.Y
	signedValue := int16(testValue)
	fmt.Printf("Original uint16 value: %d\n", testValue)
	fmt.Printf("Converted int16 value: %d\n", signedValue)
	fmt.Printf("As float64: %f\n", float64(signedValue))
	
	// Test with a value that would be negative in signed 16-bit:
	testValue2 := uint16(65535) // This is -1 in signed 16-bit
	signedValue2 := int16(testValue2)
	fmt.Printf("Original uint16 value: %d\n", testValue2)
	fmt.Printf("Converted int16 value: %d\n", signedValue2)
	fmt.Printf("As float64: %f\n", float64(signedValue2))
}
